package control.profiler;

public class Statistics {
  private double min = 0;
  private double max = 0;
  private double sum = 0;
  private int valueCount = 0;
  
  public void addValue(double value){
    sum += value;
    if(valueCount == 0){
      min = value;
      max = value;
    }
    else{
      if(value < min) min = value;
      else if(value > max) max = value;
    }    
    valueCount++;
  }
  
  public double getMinium(){
    return min;
  }
  
  public double getMaximum(){
    return max;
  }
  
  public double getAverage(){
    return (int)(sum / valueCount * 1000) / 1000d;
  }
  
  public double getSum(){
    return sum;
  }
  
  public int getValueCount(){
    return valueCount;
  }
}
